package com.ruoyi.electronicFence.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.electronicFence.domain.TEfHistoryEquipmentStatus;
import com.ruoyi.electronicFence.service.ITEfHistoryEquipmentStatusService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 场所（监测点）状态历史Controller
 *
 * @author sxygsj
 * @date 2024-08-13
 */
@RestController
@RequestMapping("/electronicFence/historyEquipmentStatus")
public class TEfHistoryEquipmentStatusController extends BaseController
{
    @Autowired
    private ITEfHistoryEquipmentStatusService tEfHistoryEquipmentStatusService;

    /**
     * 查询场所（监测点）状态历史列表
     */
   //@PreAuthorize("@ss.hasPermi('electronicFence:historyEquipmentStatus:list')")
    @GetMapping("/list")
    public TableDataInfo list(TEfHistoryEquipmentStatus tEfHistoryEquipmentStatus)
    {
        startPage();
        List<TEfHistoryEquipmentStatus> list = tEfHistoryEquipmentStatusService.selectTEfHistoryEquipmentStatusList(tEfHistoryEquipmentStatus);
        return getDataTable(list);
    }

    /**
     * 导出场所（监测点）状态历史列表
     */
   //@PreAuthorize("@ss.hasPermi('electronicFence:historyEquipmentStatus:export')")
    @Log(title = "场所（监测点）状态历史", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TEfHistoryEquipmentStatus tEfHistoryEquipmentStatus)
    {
        List<TEfHistoryEquipmentStatus> list = tEfHistoryEquipmentStatusService.selectTEfHistoryEquipmentStatusList(tEfHistoryEquipmentStatus);
        ExcelUtil<TEfHistoryEquipmentStatus> util = new ExcelUtil<TEfHistoryEquipmentStatus>(TEfHistoryEquipmentStatus.class);
        util.exportExcel(response, list, "场所（监测点）状态历史数据");
    }

    /**
     * 获取场所（监测点）状态历史详细信息
     */
   //@PreAuthorize("@ss.hasPermi('electronicFence:historyEquipmentStatus:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tEfHistoryEquipmentStatusService.selectTEfHistoryEquipmentStatusById(id));
    }

    /**
     * 新增场所（监测点）状态历史
     */
   //@PreAuthorize("@ss.hasPermi('electronicFence:historyEquipmentStatus:add')")
    @Log(title = "场所（监测点）状态历史", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TEfHistoryEquipmentStatus tEfHistoryEquipmentStatus)
    {
        return toAjax(tEfHistoryEquipmentStatusService.insertTEfHistoryEquipmentStatus(tEfHistoryEquipmentStatus));
    }

    /**
     * 修改场所（监测点）状态历史
     */
   //@PreAuthorize("@ss.hasPermi('electronicFence:historyEquipmentStatus:edit')")
    @Log(title = "场所（监测点）状态历史", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TEfHistoryEquipmentStatus tEfHistoryEquipmentStatus)
    {
        return toAjax(tEfHistoryEquipmentStatusService.updateTEfHistoryEquipmentStatus(tEfHistoryEquipmentStatus));
    }

    /**
     * 删除场所（监测点）状态历史
     */
   //@PreAuthorize("@ss.hasPermi('electronicFence:historyEquipmentStatus:remove')")
    @Log(title = "场所（监测点）状态历史", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tEfHistoryEquipmentStatusService.deleteTEfHistoryEquipmentStatusByIds(ids));
    }
}
